package com.itheima.mapper;

import com.itheima.pojo.Clazz;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface ClazzMapper {
    List<Clazz> findAll(@Param("name") String name,
                        @Param("begin") LocalDate begin,
                        @Param("end") LocalDate end
    );

    Clazz queryClazzById(@Param("id") Integer id);

    void deleteClazzById(@Param("id") Integer id);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insertClazz(Clazz clazz);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    void updateClazz(Clazz clazz);

    @Select("select * from tlias.clazz")
    List<Clazz> queryAllClazz();
}
